<template>
	<u-popup :show="show" mode="center" type="dialog" :closeable="true" @close="onClose" :round="10">
		<view class="cancel-order-popup">
			<view class="title">
				退改规则
			</view>
			<view class="title-h2">
				常规时段取消规则
			</view>
			<view class="title-detail">
				常规时段无节假日影响，按游客取消订单与约定服务开始时间的间隔划分梯度，既给向导预留重新接单时间，也让游客为临时变动承担对应成本，具体如下：
			</view>

			<view class="table-container">
				<view class="table-header">
					<view class="cell left">取消时间</view>
					<view class="cell right">手续费比例</view>
				</view>
				<view class="table-body">
					<view class="table-row" v-for="(item, index) in tableData" :key="index">
						<view class="cell left">{{ item.cancelTime }}</view>
						<view class="cell right">{{ item.feeRatio }}</view>
					</view>
				</view>
			</view>

			<view class="footer-btn" @click="onClose">
				我知道了
			</view>
		</view>
	</u-popup>
</template>

<script>
	export default {
		name: 'RefundAndChangePolicy',
		props: {
			show: {
				type: Boolean,
				default: false
			},
			tableData: {
				type: Array,
				default: () => []
			}
		},
		data() {
			return {
			}
		},
		mounted() {
			
		},
		methods: {
			onClose() {
				this.$emit('close')
			}
		}
	}
</script>

<style lang="scss" scoped>
	.cancel-order-popup {
		background-color: #fff;
		border-radius: 20rpx;
		width: calc(100vw - 40rpx);

		.title {
			text-align: center;
			margin-top: 30rpx;
			font-size: 36rpx;
			font-weight: bold;
		}

		.title-h2 {
			margin-top: 30rpx;
			font-size: 26rpx;
			font-weight: bold;
			padding-left: 30rpx;
			background-color: #FCF1DC;
			height: 60rpx;
			line-height: 60rpx;
		}

		.title-detail {
			margin-top: 20rpx;
			font-size: 24rpx;
			padding-left: 30rpx;
		}

		.table-container {
			width: calc(100% - 40rpx);
			background-color: #fff;
			border-radius: 16rpx;
			overflow: hidden;
			margin: 40rpx 20rpx 0;
			box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
			border: 1rpx solid #e0e0e0;

			.table-header {
				display: flex;
				background-color: #f5f5f5;
				font-weight: bold;
				color: #333;
				height: 90rpx;
				line-height: 90rpx;
				border-bottom: 1rpx solid #e0e0e0;
			}

			.table-body {
				.table-row {
					display: flex;
					border-bottom: 1rpx solid #e0e0e0;

					&:last-child {
						border-bottom: none;
					}
				}
			}

			.cell {
				padding: 0 20rpx;
				font-size: 26rpx;
				position: relative;
				display: flex;
				align-items: center;
				min-height: 70rpx;
				box-sizing: border-box;

				&.left {
					flex: 0 0 65%;
					/* 左侧固定宽度，根据最大内容调整 */
					text-align: left;
					padding-left: 30rpx;
					border-right: 1rpx solid #e0e0e0;
				}

				&.right {
					flex: 1;
					/* 右侧占据剩余宽度 */
					text-align: center;
					padding-right: 30rpx;
					justify-content: center;
				}

				/* 移除之前的右边框伪元素 */
				&:after {
					display: none;
				}
			}

			/* 表头单元格特殊处理 */
			.table-header .cell {
				justify-content: center;
				text-align: center;

				&.left {
					justify-content: center;
				}
			}
		}

		.footer-btn {
			text-align: center;
			background-color: #FE7131;
			margin: 40rpx 60rpx;
			border-radius: 30rpx;
			font-size: 30rpx;
			color: #fff;
			height: 70rpx;
			line-height: 70rpx;
		}
	}
</style>